﻿<?php
    defined('_JEXEC') or die();
    JHTML::_('behavior.tooltip');
    $listOrder    = @$this->lists['order'];
    $listDirn    = @$this->lists['order_Dir'];
?>

<style>
    #tbl_filter{
        margin: 0 ; padding: 0 ;
    }
    #tbl_filter td{
        padding: 3px;
    }
    #tbl_filter input, #tbl_filter img {
        float: left;
        margin: 0 5px 0 0;
        width: auto;
    }
    table.adminlist tbody tr td { padding: 8px 8px; }
    table.adminlist thead th { padding: 8px; }
</style>

<link rel="stylesheet" type="text/css" href="<?php echo JURI::root(); ?>js/multiselect/jquery.multiselect.css" />
<link rel="stylesheet" type="text/css" href="<?php echo JURI::root(); ?>js/multiselect/jquery-ui.css" />
<script type="text/javascript" src="<?php echo JURI::root();?>js/jquery.js"></script>
<script type="text/javascript" src="<?php echo JURI::root();?>js/jquery-ui.min.js"></script>
<script type="text/javascript" src="<?php echo JURI::root();?>js/multiselect/jquery.multiselect.js"></script>

<!-- Date picker -->
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
<link href="<?php echo JURI::root();?>administrator/components/com_wrd/assets/css/jquery-ui-1.9.2.custom.css" rel="stylesheet">
<script src="<?php echo JURI::root();?>administrator/components/com_wrd/assets/js/jquery-ui-1.9.2.custom.js"></script>
<!--End -->

<script type="text/javascript">
    function submitform(pressbutton){
        var form = document.adminForm ;
        if (pressbutton)
        {
            form.task.value=pressbutton ;
        }
        if ((pressbutton=='send_redemp_notice_email')||(pressbutton=='send_redemp_pick_up_notice')){
              form.controller.value="reports" ;
        }
        form.submit();
    }
    
    jQuery(function(){ 
		var date_from = "<?php echo ($this->pr['date_from'] != '') ? $this->pr['date_from'] : date('d-m', mktime(0, 0, 0, date('m'), 1)); ?>";
		var date_to = "<?php echo ($this->pr['date_to'] != '') ? $this->pr['date_to'] : date('d-m', mktime(0, 0, 0, date('m'), 31)); ?>";
		jQuery("#date_from").val(date_from);
		jQuery("#date_to").val(date_to);
		jQuery("#fr").val(date_from);
		jQuery("#to").val(date_to);

	});
    
</script>
<div class="row-fluid">    
	<?php if (!empty( $this->sidebar)) : ?>
	<div id="j-sidebar-container" class="span2">
		<?php echo $this->sidebar; ?>
	</div>
	<div id="j-main-container" class="span10">
	<?php else : ?>
		<div id="j-main-container">
	<?php endif;?>
		<br clear="all">    
        <div class="alert">
            <form action="<?php echo JRoute::_("index.php?option=com_wrd&controller=reports")?>" method="post" name="filterform" >
                <table style='margin-bottom:5px' id="tbl_filter">
                    <tbody>
                    	<tr>
							<td width="50%">
								<table>
                                    <tr valign="top">
                                        <td style="cursor:pointer;font-weight: bold;" valign="top" width='35px' title="Ngày - Tháng">From</td>  
                                        <td valign="top" width='150px'>

										   <?php
												
												echo JHTML::_ ( 'calendar', '%d-%m', 'date_from', 'date_from', '%d-%m');
                                            ?>
                                        </td>
                                       
                                    </tr>
                                    <tr>
                                        <td style="cursor:pointer;font-weight:bold;" width='35px' title="Ngày - Tháng">To</td>        
                                        <td width='150px'>
										   <?php
												echo JHTML::_ ( 'calendar',  '%d-%m', 'date_to', 'date_to', '%d-%m');
                                            ?>
                                        </td>
                                      
                                    </tr>
                                    <tr>
                                    	<td colspan="2">
                                    		<input type="submit" name="view" onclick="document.getElementById('task').value = 'memberbirthday';" value="View" />
                                    	</td>
                                    </tr>
								</table>
							</td>
							<td>
								<table>
									<tr>
										<td> <strong> Choose &nbsp; </strong>
											<select name="topDisplaySelect" id="topDisplaySelect">
												<option value="0">All</option>
												<option value="5">5</option>
												<option value="10">10</option>
												<option value="15">15</option>
												<option value="20">20</option>
												<option value="25">25</option>
												<option value="30">30</option>
												<option value="50">50</option>
												<option value="100">100</option>
										    </select>
									  </td>
									</tr>
									<tr>
										<td>
											<input type="submit" name="exportexcel" onclick="document.getElementById('task').value = 'exmemberbirthday';" value="Export to excel" />
										</td>
									</tr>
								</table>
							</td>
                                               
                        </tr>
                    </tbody>
                </table>
                <input type="hidden" name="controller" value="reports" />
                <input type="hidden" name="option" value="com_wrd" />
                <input type="hidden" name="task" id="task" value=""/>
				
            </form>
           </div>
           <br clear="all">
           <form  id="adminForm"  action="<?php echo JRoute::_("index.php?option=com_wrd&controller=report")?>" method="post" name="adminForm" >			
<style>
.extra-adminlist strong { color:#025A8D; font-size: 1.2em; font-weight: bold; }
table.extra-adminlist .extra-adminlist-tr td {background: #F7F7F7; }
.filter-detail { border-top: 1px solid #CCC; padding-bottom: 3px; font-size: 1.4em; }
.filter-detail span { color: #e72222; }
</style>
<h3 class="filter-detail"><br/><span style="color:#C00; float:right;">Total: <?php echo $this->pagination->total; ?></span></h3>
<table class="adminlist extra-adminlist table">
  <thead>
    <tr class="extra-adminlist-tr" >
        <th nowrap="nowrap"><strong>No</strong></th>                   
		<th nowrap="nowrap"><strong>Member ID</strong></th>	
		<th nowrap="nowrap"><strong>Title</strong></th>
		<th nowrap="nowrap"><strong>Name</strong></th>
		<th nowrap="nowrap"><strong>Email</strong></th>		
		<th nowrap="nowrap"><strong>Phone</strong></th>
		<th nowrap="nowrap"><strong>Day of Birth</strong></th>
		<th nowrap="nowrap"><strong>District</strong></th>
		<th nowrap="nowrap"><strong>City</strong></th>
		<th nowrap="nowrap"><strong>Nationality</strong></th>
    </tr>
  </thead>
  <tbody>
<?php
                $i = 0;
				foreach($this->items as $item):
				echo '<tr style="cursor: pointer;" class="row'.($i%2).'" valign="top">';
                    echo '<td>'. ++$i .'</td>';
					echo '<td>'.$item->member_id.'</td>';
					echo '<td>'.$item->prefix.'</td>';	
					echo '<td>'.$item->full_name.'</td>';
					echo '<td>'.$item->p_email.'</td>';
					echo '<td>'.$item->phone.'</td>';
					echo '<td>'.date('d-m-Y',strtotime($item->dob)).'</td>';
					echo '<td>'.(empty($item->district) ? $item->c_district:$item->district) .'</td>';
					echo '<td>'.(empty($item->city) ? $item->c_city:$item->city).'</td>';
					echo '<td>'.$item->nationality .'</td>';	
                echo '</tr>';
            endforeach;
    ?>
    
  </tbody>
  <tfoot>
        <tr>
            <td colspan="16">
                <?php echo $this->pagination->getListFooter();?>
            </td>
        </tr>
    </tfoot>
</table>
                <input type="hidden" id="fr" name="date_from" value="" />
				<input type="hidden" id="to" name="date_to" value="" />
				<input type="hidden" name="controller" value="reports" />
                <input type="hidden" name="option" value="com_wrd" />
				<input type="hidden" name="topDisplaySelect" id="topDisplay" value="" />
				<input name="status" type="hidden" class="status" value="" />
                <input type="hidden" name="task" value="memberbirthday" />
                <?php echo JHTML::_( 'form.token' ); ?>
            </form>

        </div>
        
</div>